/*
============================================================================
 Name        : dd_player_config.c
 Author      : Jian
 Version     :
 Copyright   : GPL
 Description : dd_player_config.c - source file
============================================================================
*/

/* INCLUDE FILES */
#include "dd_player_config.h"
#include "dd_ini_reader.h"
#include "dd_log.h"


DD_UINT ddPlayerFileBufSize      = DD_PLAYER_FILE_BUFFER_SIZE ;
DD_UINT ddPlayerOutBufSize       = DD_PLAYER_OUTPUT_BUFFER_SIZE ;
DD_UINT ddPlayerOutBufQueueCount = DD_PLAYER_OUTPUT_QUEUE_COUNT ;

void dd_config_init() 
{
    int         tmp = 0 ;
    const char* logPriorityKey = dd_ini_read_key("logPriority") ;
    const char* fileBufferSizeKey = dd_ini_read_key("fileBufferSize") ;
    const char* outputBufferSizeKey = dd_ini_read_key("outputBufferSize") ;
    const char* outputQueueCountKey = dd_ini_read_key("outputQueueCount") ;

    if (logPriorityKey) {
        tmp = atoi(logPriorityKey) ;
        if (tmp >= DD_LOG_PRIORITY_TRACE && tmp <= DD_LOG_PRIORITY_NO_LOG)
             ddLogPriority = tmp ;
    }

    if (fileBufferSizeKey) {
        tmp = atoi(fileBufferSizeKey) ;
        if (tmp > 0) 
            ddPlayerFileBufSize = tmp ;
    }   

    if (outputBufferSizeKey) {
        tmp = atoi(outputBufferSizeKey) ;
        if (tmp > (1152 * 2 * 2) && (tmp % 4 == 0)) 
            ddPlayerOutBufSize = tmp ;
    }

    if (outputQueueCountKey) {
        tmp = atoi(outputQueueCountKey) ;

        if (tmp > 0) 
            ddPlayerOutBufQueueCount = tmp ;
    }
}

/* End of File */
